# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=sonnet
pkgver=5.73.0
pkgrel=0
pkgdesc="Spelling framework for Qt5"
arch="all !armhf" # armhf blocked by extra-cmake-modules
url="https://community.kde.org/Frameworks"
license="LGPL-2.1-only"
depends="hunspell"
depends_dev="qt5-qtbase"
makedepends="$depends_dev extra-cmake-modules qt5-qttools-dev doxygen hunspell-dev"
checkdepends="xvfb-run"
source="https://download.kde.org/stable/frameworks/${pkgver%.*}/sonnet-$pkgver.tar.xz"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"

build() {
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_QCH=ON
	cmake --build build
}

check() {
	cd build

	# sonnet-test_autodetect fails to detect a speller backend
	CTEST_OUTPUT_ON_FAILURE=TRUE xvfb-run ctest -E "sonnet-test_autodetect"
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
}
sha512sums="b5b69d34cda323bc5cbbe1bfafaaff324194ce241bef80f8f3c74ff3cd00e00cdeff20eafca870d6d99c5f080fd44e54458d261c2c795ba2179233d4ad8f70c1  sonnet-5.73.0.tar.xz"
